package Reflect;

import java.util.ArrayList;
import java.util.Scanner;

public class ReflectDemo2 {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
        ArrayList list=new ArrayList();
        System.out.println(list);

        Scanner sc=new Scanner(System.in);
        System.out.println("请输入类名");
        String className=sc.nextLine();
        Class cla=Class.forName(className);
        Object obj=cla.newInstance();
        System.out.println(obj);
    }
}
